package models

import "time"

// CardStatusHistory 卡片状态变更历史
type CardStatusHistory struct {
	ID        int64     `gorm:"primaryKey;autoIncrement" json:"id"`
	CardID    string    `gorm:"column:card_id;type:varchar(50);not null" json:"card_id"`
	OldStatus string    `gorm:"column:old_status;type:varchar(20)" json:"old_status"`
	NewStatus string    `gorm:"column:new_status;type:varchar(20);not null" json:"new_status"`
	ChangedAt time.Time `gorm:"column:changed_at;not null" json:"changed_at"`
	ChangedBy string    `gorm:"column:changed_by;type:varchar(50);not null" json:"changed_by"`
	Reason    string    `gorm:"column:reason;type:varchar(255)" json:"reason"`
	CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" json:"updated_at"`
}

// TableName 指定表名
func (CardStatusHistory) TableName() string {
	return "card_status_history"
}
